home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / misc / picalc26.lha / picalc / piCalc.Doc < prev   
Text File  |  1995-09-26  |  9KB  |  226 lines

  1. *******************************************************
  2. piCalc - A program to find ¶ - pi - about 3.14159265...
  3. *******************************************************
  4.  
  5. QUICKSTART:
  6.  
  7. From the shell type:
  8.  
  9. piCalc 1000
  10.  
  11. and piCalc will calculate and display 1000 decimal places of pi.
  12.  
  13.  
  14.  
  15. Requirements to using piCalc V2.6:
  16. - Amiga with 68020 or better CPU  (a FPU is not needed and not used anyway)
  17. - Workbench/Kickstart 2.04 or better (I haven't tested it with less than 3.0)
  18. - About 2.5 times as much bytes memory as the accuracy you want pi
  19. - Time (and patience!)
  20.  
  21. It uses no external libraries.
  22.  
  23. This program is Freeware: It may be distributed freely for non-commercial
  24. purposes. It should be free and a copying fee must not exceed £2.
  25. This program may not be distributed with any magazine-coverdisk without
  26. written permission. It may be included in any PD-library or on CDs including
  27. PD software, such as the Fish, Aminet and other series including similar
  28. free software.
  29.  
  30. The program and this docfile may not be changed or modified!
  31.  
  32. YOU USE THIS PROGRAM ON YOUR OWN RISK. THE AUTHOR CAN NOT AND WILL NOT
  33. GUARANTEE ITS ACCURACY, NOR ANY OTHER DAMAGES ARISING FROM ANY USE OR
  34. MISUSE OF THIS PROGRAM AND DOCUMENTATION.
  35.  
  36. If publishing a result produced by piCalc, please give credit to the author
  37. and state which version of the program you used (V2.6).
  38.  
  39.  
  40. History
  41. -------
  42.  
  43. This program started as an AMOS program, which was able to calculate pi
  44. to 80 decimal places, in JUST 35 MINUTES! (Amiga 1200) Because as we all know,
  45. AMOS is not particularly fast, so I ported the program to assembler, the
  46. first assembler version was able to calculate the first 1000 decimal places
  47. in 5 minutes. But this wasn't good enough, so I optimised the
  48. assembler-program to be many times faster than the original assembler-program.
  49. That is the program "piCalc" V2.6 and runs 75,000 times faster than the
  50. original (uncompiled) AMOS-program.
  51.  
  52. Version 1.0 - 1.7 were 68000 code versions, never released publically.
  53. Version 2.0 - 2.4 were based on the 68020, never released.
  54.  
  55. Version 2.5 was released 16th of July 1995
  56.  
  57. Version 2.6 uses a better formula to calculate pi and stores pi in binary
  58.             internally: In total this makes version 2.6 more than 50% faster
  59.             than version 2.5. It's a bit more memory hungry though.
  60.  
  61. How to use it
  62. -------------
  63.  
  64. piCalc is Shell/CLI-only utility. To use it you have to open a shell-window.
  65. In its simplest form you write (from Shell)
  66.  
  67. You can always stop the program with Ctrl-C. (Exception: You can't Ctrl-C
  68. piCalc when it's displaying/saving pi.)
  69.  
  70. "piCalc XXXXX" where XXXXX is the number of decimal places piCalc should
  71. calculate.
  72.  
  73. The higher number of decimal places the more time the calculation will take.
  74. If you think of calculating many decimal places (more than 20000) you should
  75. run piCalc with the "ESTIMATE" option:
  76.  
  77. "piCalc estimate 100000" will estimate how much time a calculation of 100000
  78. decimal places will take, so that you won't be surprised by how slow things
  79. are going.
  80.  
  81. If you want to save the result to a file, use "SAVEFILE=filename", the result
  82. will be written to this file when it has finished.
  83.  
  84.  
  85. Those options in full
  86. ---------------------
  87.  
  88. Type "piCalc ?" for the piCalc Template:
  89.  
  90. DECIMALS/N,EVERY/N,SAVEFILE,SAVEEVERY/N,NOTIFY/S,NOOUTPUT/S,ESTIMATE/S
  91.  
  92.  
  93. DECIMALS
  94. is the number of decimal places you want piCalc to calculate, this must be
  95. between 1 and 2,147,483,647. Except when "ESTIMATE" is selected, you will
  96. need about 2.5 times as much memory free as the number of decimal places you
  97. want to calculate pi to. (e.g. 1,000,000 decimal places requires about 2.5 MB
  98. memory, in 6 chunks of <400 kb)
  99. (If not specified, the program uses 50 decimal places)
  100.  
  101. EVERY
  102. is how often you want piCalc to output its current calculation of pi. If you
  103. use "EVERY 10000" piCalc will output to screen (StdOut) when it has 10000, 
  104. 20000, 30000 and so on of decimal places. This option is probably most useful
  105. when used with the "NOTIFY" option.
  106.  
  107. SAVEFILE
  108. when specified piCalc will save its calculation to the specified file, this
  109. it a much nicer method than running piCalc with a ">" redirection file.
  110. Beware: If piCalc can't create this file it would not give any error messages,
  111. just continue on!
  112.  
  113. SAVEEVERY
  114. specifies how often piCalc should save its current calculation to SAVEFILE.
  115.  
  116. NOTIFY
  117. is a very useful option in conjunction with the EVERY and SAVEFILE
  118. options. It notifies you how far it has come, writing "Dec: XXXX"  to the
  119. Shell-window, where XXXX is how many decimal places it has calculated so
  120. far, so you have some kind of control of the process.
  121. Write NOTIFY EVERY 1000 to have piCalc notify you every time it has
  122. calculated 1000 new decimal places.
  123.  
  124. NOOUTPUT
  125. is useful when you use the SAVEFILE option and don't want the pi to be
  126. echoed to screen as this can take quite a while with many decimal places.
  127.  
  128. ESTIMATE
  129. will estimate the TIME needed to calculate pi. The estimating may take
  130. a number of seconds (5-20) but will display a rough indication on how
  131. long the calculation will take: You should not touch the mouse or keyboard
  132. during this test, as this will cause piCalc to over-estimate the time needed.
  133.  
  134.  
  135. Is piCalc calculating the right value for pi?
  136. ---------------------------------------------
  137.  
  138. I can not and will not guarantee the result produced by piCalc, it though
  139. seems to print the right values. Browsing through old editions of
  140. "The Guinness Book of Records" under "Most accurate version of 'pi'" I have
  141. been able to check some parts of the results.
  142. In the 1980 edition, I found this description of pi: 3.141592653589793 ...
  143. (omitting the next 999,975 places) ... 5779458151
  144. Those last 10 decimal places compared exactly to the result produced by
  145. piCalc 1000000, using the same method I have checked the decimal places
  146. before 100000 and 500000 to piCalc and found them to be the same, so piCalc
  147. seems to give correct values for pi.
  148. The first 50000 decimal places have been compared to those found in several
  149. WWW-homepages. (Guess: They were the same!)
  150.  
  151. In the "E" Amiga programming environment there is a demo program, "pi.e"
  152. which besides that its much slower than piCalc produces the wrong number
  153. when you choose any high number, so better use piCalc!
  154.  
  155.  
  156. Please don't have a large number of other programs running when piCalc
  157. is busy calculating. A single bug in any of the programs running alongside
  158. piCalc could accidentally write to a memory location used by piCalc and
  159. giving a wrong result as piCalc does absolutely NONE checking on the
  160. result as this would decrease performance considerably.
  161.  
  162.  
  163. Program technicals (programmers)
  164. ---------------------------------
  165.  
  166. This program uses 32/64 bit integer math, using the Mulu.L/Divu.L instructions
  167. heavily. The speed of this program therefore is largely dependent on the speed
  168. the CPU carries out such multiplications and dividitions. The program stores
  169. PI in one long chunk of binary, where each longword represents about 
  170.  
  171.  
  172. Why is 68020 required?
  173.  
  174. Just because I was able to make the program 3 times faster when I could
  175. 68020 instructions instead of 68000 only. For 68060 users this may not be
  176. the fact though, as these 68020 instructions are NOT supported by the 68060
  177. and have to be emulated, so 68060 & piCalc 2.6 is not a fast combination...
  178. sorry. Contact me if you have an 68060!!!
  179.  
  180. Program technicals (math)
  181. -------------------------
  182.  
  183. Calculation method used in piCalc 2.5: (Sorry, I gave a wrong formula in
  184. the piCalc 2.5 documentation)
  185.  
  186.   16/(1*5^1)  - 16/(3*5^3)   + 16/(5*5^5)   - 16/(7*5^7)   + 16/(9*5^9)...
  187. - 4/(1*239^1) +  4/(3*239^3) -  4/(5*239^5) +  4/(7*239^7) -  4/(9*239^9)...
  188.  
  189. New formula used in piCalc 2.6:
  190.  
  191. pi/4 = 44*arctan(1/57) +7*arctan(1/239) -12*arctan(1/682) +24*arctan(1/12493)
  192.  
  193. where arctan(1/x) is calculated: 1/x - 1/(3*x^3) + 1/(5*x^5) - 1/(7*x^7) ...
  194.  
  195. If you know a better formula/method or know another pi-calculation program
  196. (that is faster), please email/write to me!
  197.  
  198. Author
  199. ------
  200.  
  201. Write if you know of any SERIOUS bugs (pi is not accurate, fails on 68060,
  202. etc.) If you have calculated pi with more than 1,000,000 decimal places using
  203. this program or know a more efficient formula or another Amiga program that
  204. is faster, please write!
  205.  
  206. Also look out for eCalc V2.6 that is identical to piCalc V2.6 except that it
  207. calculates e=2.718281828459045... (and it's much faster than piCalc)
  208.  
  209. My email-address is: steffent@stud.unit.no
  210. My WWW-homepage is: http://www.stud.unit.no/~steffent  (it's rather small
  211. currently...)
  212.  
  213. My snail-mail address: (safe, but slow: 1-3 weeks)
  214. Steffen Thorsen
  215. Fjordgt. 8a
  216. N-4300 Sandnes
  217. Norway
  218.  
  219. Snail-mail while im studying (usually fast, except during my holidays
  220. (Christmas, Easter, Summer: [June-August]):
  221.  
  222. Steffen Thorsen
  223. Stud.post 198, NTH
  224. N-7043 Trondheim
  225. Norway
  226.